{% extends 'xadmin/base.html' %}
{% load i18n xadmin_tags %}


{% block title %}{{ title }} | {{ site_title }}{% endblock %}

{% block extrastyle %}

    <style style="text/css">
      #sap-container{position: relative;width: 100%;height: 100%;}
      #sap-container iframe{display: block;width: 100%;height: 100%;border: none;}
    </style>
  <link rel="stylesheet" type="text/css" href="{% static "adminlte/plugins/pace/pace.min.css" %}" />
  <link rel="stylesheet" type="text/css" href="{% static "xadmin/css/xadmin.frame.css" %}" />
<script>
/*
paceOptions = {
    elements: {
        selectors: ['#sap-container body']
    }
}
*/
</script>
{% endblock %}

{% block headfix %}
{% endblock %}

{% block body %}
<div class="wrapper">

    <!-- Header -->
    {% block header %}
      {% include 'xadmin/includes/head_nav_ext.html' %}
    {% endblock %}


    <!-- left side menu -->
    {% block left_menu %}
    <aside class="main-sidebar">
    <div class="sidebar">
        {% block navbar %}
        {% if nav_menu %}
          {% include menu_template %}
        {% else %}
          <p></p>
        {% endif %}
      {% endblock %}
      {% view_block 'left_navbar' %}
    </div>
    </aside>
    {% endblock %}

    <div id="content-block" class="content-wrapper" >

            <!-- 右侧iframe展示区域  -->
            <div id="sap-container">
            </div>

    </div>


</div>
{% endblock body %}


{% block extrabody %}
    <!-- 遮罩层end -->
    <div class="loading-content" style="left: 50%;top: 114.5px;display:none">加载中…</div>
    <script src="/static/xadmin/js/iframer.js" type="text/javascript"></script>

    <script>
    // To make Pace works on Ajax calls
    $(document).ajaxStart(function() { Pace.restart(); });

        $(document).ready(function() {
            
            $(".sidebar-menu a.jumpto").on("click", function (){
                //var to = $(this).attr("href");
                //if (to.length>1){
                if ($(this).hasClass('jumpto')){
                    $(".sidebar-menu a.jumpto").parent().removeClass('active');
                    $(this).parent().addClass('active');
                    //iframer.jumpTo(to);
                    //return false;
                }
            });
            

            function fix_height() {
                var h = $(window).height() - 52 + "px"
                //$('#content-block').css("height",h);
                $('#sap-container').css("height",h);
                //$('#sap-container iframe').contents().find("#content-block").css("min-height",h);
            }

            $(window).bind("load resize scroll", function () {
                fix_height();
            });

        });

      iframer.init({
         default_url: window.__admin_path_prefix__,
         //存放iframe的容器
         container : document.getElementById('sap-container'),
         expect_class : 'spa-expect-links',
         //iframeOnload: function(){
         //}
      });
    </script>
{% endblock %}
